Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasi: Implements wasi_snapshot_preview1.poll_oneoff for relative clock events #629

Merged
merged 4 commits into from
Jun 17, 2022

Conversation

codefromthecrypt
Copy link
Contributor

@codefromthecrypt codefromthecrypt commented Jun 16, 2022

This implements wasi_snapshot_preview1.poll_oneoff for relative clock events,
and in doing so stubs Nanosleep which defaults to noop, but can be configured
to time.Sleep.

Special thanks to @clarkmcc for the failing test here!

fixes #625

clockIDRealtime = iota
// clockIDMonotonic is the clock ID named "monotonic" with sys.Nanotime
clockIDMonotonic
// clockIDProcessCputime is the unsupported clock ID named "process_cputime_id"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these values are new. mainly, changes in this file are validation only and fix to return ErrnoNotsup on unsupported

@codefromthecrypt
Copy link
Contributor Author

want to check how go implements sleep also.. #621

…k events

This implements wasi_snapshot_preview1.poll_oneoff for relative clock events,
and in doing so stubs `Nanosleep` which defaults to noop, but can be configured
to `time.Sleep`.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
Adrian Cole added 2 commits June 17, 2022 13:56
Signed-off-by: Adrian Cole <adrian@tetrate.io>
Signed-off-by: Adrian Cole <adrian@tetrate.io>
@codefromthecrypt codefromthecrypt marked this pull request as ready for review June 17, 2022 08:40
| sock_recv | ❌ | |
| sock_send | ❌ | |
| sock_shutdown | ❌ | |
| Function | Status | Known Usage |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one day we want to have CI to verify that this is actually correct :D


For example, the below ends up calling `wasi_snapshot_preview1.poll_oneoff`:

```zig
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it

Signed-off-by: Adrian Cole <adrian@tetrate.io>
@codefromthecrypt codefromthecrypt merged commit 30be6a8 into main Jun 17, 2022
@codefromthecrypt codefromthecrypt deleted the poll-sleep branch June 17, 2022 08:48
@codefromthecrypt
Copy link
Contributor Author

Thanks for the quick review turnaround @mathetake!

@clarkmcc
Copy link

Excellent, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support WASI poll_oneoff for clock events
3 participants